#ifndef PIPC_HPP
#define PIPC_HPP

#include "transport_interface.hpp"

class TiXmlNode;

namespace pipc
{

class Pipc
{
public:
    static Pipc* Instance();

    bool initialize(std::string fname, std::string id);
    bool release();
    void setValue(std::string key, Record value);
    Record getValue(std::string key);
    bool subscribe(std::string key, bool reader);
    void clear();
    bool isSynced(std::string key);
    bool start();
    bool stop();
    bool isRunning();

private:
    ///Singleton
    Pipc();
    Pipc(Pipc const&);
    Pipc & operator=(Pipc const&);
    static Pipc* _instance;
    bool running_;
    bool initialized_;

    //Transport
    TransportInterface * t_;
    std::string type_;
    std::string id_;
    bool setupLocalTransport_();
    bool setupServerTransport_(TiXmlNode * transport);
};

}
#endif // PIPC_HPP
